#include <fstream>
#include <iostream>
#include <vector>

//
// Created by lingzhitech on 25-9-12.
//
// Write a function to open a file for input and read
// its contents into a vector of string s, storing each line as a
// separate element in the vector .
int main() {
    std::fstream fs("Sales_data_input");
    std::string s;
    std::vector<std::string> v;
    if (!fs) {
        std::cout << "Can't open file";
    }else {
        // 标准输入流的提取运算符 >> 会自动 跳过空白字符（空格、换行、tab），并把下一个单词读到字符串里。
        while (fs >> s) {
            v.push_back(s);
        }
    }
    for (auto s : v) {
        std::cout << s << std::endl;
    }
}